package com.itheima.stock.controller;

import com.itheima.stock.pojo.entity.SysLog;
import com.itheima.stock.pojo.vo.req.P;
import com.itheima.stock.pojo.vo.req.PageResult;
import com.itheima.stock.pojo.vo.req.Plog;
import com.itheima.stock.pojo.vo.resp.R;
import com.itheima.stock.service.LogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
public class LogsController {

    @Autowired
    private LogsService logsService;
    @PreAuthorize("hasAuthority('sys:log:list')")
    @PostMapping("/logs")
    public R<PageResult<SysLog>> PageLogs(@RequestBody Plog plog){
        return logsService.PageLogs(plog);
    }
    @PreAuthorize("hasAuthority('sys:log:delete')")
    @DeleteMapping("/log")
    public R delLog(@RequestBody List<Long> logIds){
        return logsService.delLog(logIds);
    }
}
